opening_brackets = '([{<'
closing_brackets = ')]}>'
s = input('Введите последовательность скобок:')
stack = []
for i in s:
    if i in opening_brackets:
        stack.append(i)
        continue
    if i in closing_brackets:
        if len(stack) == 0:
            stack.append(i)
            break
        if stack[-1] == opening_brackets[closing_brackets.index(i)]:
            stack.pop()
        else:
            break
        
if len(stack) == 0:
    print('True')
else:
    print('False')
    
        
    